package com.ruoyi.tws.controller;

import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.PinYinUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RequiredArgsConstructor(onConstructor_ = @Autowired)
@RestController
@RequestMapping("/utils" )
public class UtilsController extends BaseController {
    /**
     * 求助记码
     */
    @GetMapping("/getShortCode")
    public AjaxResult getShortCode(@RequestParam("shortName") String shortName) {
        String shortCode = PinYinUtils.toFirstPinYin(shortName);
        return AjaxResult.success(shortCode);
    }
}
